package com.auto.survey.activity.monitoring.modle

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class InitCollectionVeiwModle: ViewModel() {
    companion object {
        val STATION_X = "STATION_X"
        val STATION_Y = "STATION_Y"
        val STATION_Z = "STATION_Z"
        val EQUMENT_H = "EQUMENT_H"
    }
    val station = MutableLiveData<Map<String, Double>>()

    fun notifyEqStation(eqStX: Double, eqStY: Double, eqStZ: Double, height: Double) {
        viewModelScope.launch {
            val result = withContext(Dispatchers.IO){
                val map = HashMap<String, Double>()
                map[STATION_X] = eqStX
                map[STATION_Y] = eqStY
                map[STATION_Z] = eqStZ
                map[EQUMENT_H] = height
                map
            }

            station.value = result
        }
    }
}